import org.apache.zookeeper.ZooKeeper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

/**
 * @ClassName Main
 * @Description TODO
 * @Author BossZ
 * @Version 1.0
 * @Date 2019/1/15-18:02
 **/
public class Main {
    public static final String zkServerPath ="192.168.137.12:2181";
    public static final Integer zkTimeOut =200;

    public static final Logger log  = LoggerFactory.getLogger(Main.class);
    public static void main(String[] args) throws IOException, InterruptedException {
        ZooKeeper zk = new ZooKeeper(zkServerPath,zkTimeOut,(e)->{
            log.info("-----"+e.getState().name());
        });

        log.info("客户端开始连接zookeeper");
        log.info("连接状态:{}"+zk.getState());

        TimeUnit.SECONDS.sleep(10);
    }
}
